//
//  HRZAPIRequest.h
//  EMarket
//
//  Created by 物联速通信息技术有限公司 on 2018/5/23.
//  Copyright © 2018 好日子. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef NS_ENUM(NSInteger, APIRequestType) {
    kAPIRequestType_Get,        //  Get
    kAPIRequestType_Post,       //  Post
    kAPIRequestType_Upload,     //  上传图片
};

@interface HRZAPIRequest : NSObject

- (id)initWithAPIRequestType:(APIRequestType)type withSubPath:(NSString *)subPath;

@property (nonatomic, copy) void(^ServerSuce) (NSDictionary *sucObj);
@property (nonatomic, copy) void(^ServerFail) (NSString *error);

#pragma mark - 基本属性
/** 请求类型 */
@property (nonatomic) APIRequestType requestType;
/** 请求路径 */
@property (nonatomic, copy) NSString *subUrl;
/** 服务器地址 */
@property (nonatomic, copy) NSString *serviceUrl;
/** 完整路径 */
@property (nonatomic, copy) NSString *fullUrl;
/** 请求参数数组 */
@property (nonatomic, strong) NSMutableDictionary *params;
/** 上传图片 */
@property (nonatomic, strong) NSMutableArray *images;

#pragma mark - 分页相关
@property (nonatomic, assign) NSInteger requestCurrentPage;// 当前请求页 分页从0开始
@property (nonatomic, assign) NSInteger requestMaxPage;// 最大请求页
#pragma mark - 基本方法
- (void)addParam:(id)param;

#pragma mark - APIRequestDelegate回调方法
/** 返回数据调用方法 */
- (void)callBackFinishedWithDictionary:(NSDictionary *)dic;
/** 返回数据错误 */
- (void)callBackFailed:(NSError *)error;
@end
